package com.sx.micowell.framework.model

import com.example.mvvm.base.data.MutableLiveListData
import com.example.mvvm.base.vm.BaseViewModel
import com.miloyu.modelnet.network.ApiResponse
import com.miloyu.modelnet.network.HttpClient
import com.miloyu.modelnet.network.tools.RxUtils
import com.miloyu.modelnet.response.PlanStatusWrap
import com.miloyu.modelnet.response.TrainListSetting
import com.miloyu.modelnet.response.TrainListSettingInfo
import java.util.function.Consumer

/**
 * @Description
 * @Author 梁浩文
 * @Date 2021/9/1 9:38
 */
class TrainSettingModel :BaseViewModel() {
    var trainSettingList:MutableLiveListData<TrainListSettingInfo> = MutableLiveListData()
    var selectTrainSettingList:MutableList<TrainListSettingInfo> = mutableListOf<TrainListSettingInfo>()
    //动作列表
    fun reqActionList(ids :String){
        HttpClient.instance.apiService
            .getActionList(ids)
            .compose(RxUtils.compose())
            .subscribeWith(object : ApiResponse<TrainListSetting>() {

                override fun success(data: TrainListSetting?, msg: String?) {
                    data?.info?.let {
                        trainSettingList.postValue(it)
                    }

                }

                override fun onFail(e: Throwable?, errorMsg: String?) {

                }

            })

    }
}